//
//  HttpRequestHeader.m
//  HttpAPIRequest
//
//  Created by admin on 2019/4/29.
//  Copyright © 2019 admin. All rights reserved.
//

#import "HttpRequestHeader.h"
#import <IBase/IBase.h>

@implementation HttpRequestHeader


+ (NSDictionary *)requestHeaderWithToken:(NSString *)token lon:(float)lon lat:(float)lat{
        
                NSMutableDictionary* header = [NSMutableDictionary new];
        ///内容格式
        [header setValue:@"application/json" forKey:@"Content-Type"];
        ///用户Token
        if(token.length){
            [header setValue:token forKey:@"token"];
        }
        ///网络类型
        [header setValue:[Device reachableViaType] forKey:@"c-nw"];
        ///服务端api版本
        [header setValue:[App version] forKey:@"c-iv"];
        ///客户端名称
        [header setValue:[App name] forKey:@"c-mo"];
        ///客户端类型 1:安卓，2:IOS
        [header setValue:@"2" forKey:@"c-ct"];
        ///屏幕宽高
        [header setValue:[NSString stringWithFormat:@"%f",SCREEN_WIDTH] forKey:@"c-cw"];
        [header setValue:[NSString stringWithFormat:@"%f",SCREEN_HEIGHT] forKey:@"c-ch"];
        ///渠道
        [header setValue:@"0" forKey:@"c-sr"];
        ///位置信息
        [header setValue:[NSString stringWithFormat:@"%f",lon] forKey:@"c-lng"];
        [header setValue:[NSString stringWithFormat:@"%f",lat] forKey:@"c-lat"];
        ///品牌名
        [header setValue:[Device machineMode] forKey:@"c-br"];
        ///系统版本
        [header setValue:[UIDevice currentDevice].systemVersion forKey:@"c-sv"];
        ///app内部版本
        [header setValue:[App version] forKey:@"c-cv"];
        ///设备唯一标识
        [header setValue:[IdfvTool getIDFV] forKey:@"c-im"];
        
        [header setValue:[NSString stringWithFormat:@"%ld",[App type]] forKey:@"c-st"];
        
        return header;
}
    
@end
